#include "generator.h"
#include "task.h"
#include <iostream>

co_async::Generator<int> test_gen() {
  for (int i = 0; i < 10; i++) {
    co_yield i;
  }
}

co_async::Task<void> test() {
  auto t = test_gen();
  while (auto opt = co_await t) {
    std::cout << *opt << std::endl;
  }
  co_return;
}

int main() {
  auto t = test();
  while (!t.get_handle().done()) {
    t.get_handle().resume();
  }
}